﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PanelFramePresenter.ascx.cs" Inherits="Forums_Presenters_PanelFramePresenter" %>
<%@ Register Src="PanelPresenter.ascx" TagName="PanelPresenter" TagPrefix="uc" %>
<div style="padding: 0px 20px;">
  <div style="padding: 5px 0px;">
    <div style="clear: both;">
      <div style="float: left; font-size: 30px; font-family: 黑体; padding-right: 20px;"><%#Container.EvalView( "Title" ) %></div>
      <div style="float: right; padding: 10px; font-family: 黑体; font-size: 12pt;" runat="server" id="CreateTopicContainer" visible="false"><asp:HyperLink ID="CreateTopicLink" ForeColor="Black" runat="server" Text="发表新帖" /></div>
    </div>
    <div id="BoardFrameExtendInfo" runat="server" visible="false" style="clear: both; padding: 0px 20px; font-size: 14px; font-family: 新宋体, 宋体; font-style: italic;">
      <div style="float: left; width: 100px;"><%#Container.EvalView( "Topics", "主题:{0}" ) %></div>
      <div style="float: left; width: 100px;"><%#Container.EvalView( "Posts", "帖子:{0}" ) %></div>
    </div>
    <div style="clear: both;"></div>
  </div>
  <asp:PlaceHolder ID="TopicListPlace" runat="server" Visible="false">

    <table id="topicList" class="topic-list" border="1" cellpadding="3" cellspacing="0">
      <thead>
        <tr>
          <td colspan="2" style="height: 20px;">标题</td>
          <td>作者</td>
          <td>回帖&nbsp;/&nbsp;阅读</td>
          <td><span id="LastPublishButton" style="cursor: pointer; color: #999999;" onclick="showLastPublish();">最后发表</span>&nbsp;/&nbsp;<span id="LastModifyButton" style="cursor: pointer; color: #999999;" onclick="showLastModify();">最后修改</span></td>
          <td>操作</td>
        </tr>
      </thead>
      <asp:Repeater runat="server" ID="TopicList" DataSource='<%#Container.EvalView( "TopicItems" ) %>'>
        <ItemTemplate>
          <xc:Presenter runat="server" View="<%#Page.GetDataItem() %>">
            <tr>
              <td class="icon"><a href="FrameView.aspx?route=<%# HttpUtility.UrlEncode( Container.EvalView("TopicId", GetRoute() + "/#{0}" ) )%>" title="新窗口打开" target="_blank"><asp:Image ID="Image1" runat="server" ImageUrl="~/images/topic_common.gif" BorderWidth="0" /></a></td>
              <td class="title"><a href="FrameView.aspx?route=<%#HttpUtility.UrlEncode( Container.EvalView("TopicId", GetRoute() + "/#{0}" ) )%>"><%#HttpUtility.HtmlEncode( (string) Container.EvalView( "Title" ) )%></a></td>
              <td class="launcher"><a href="MemberView.aspx?Username=<%#Container.EvalView("Launcher") %>"><%#Container.EvalView("Launcher") %></a></td>
              <td class="numbers"><strong><%#Container.EvalView("Responses") %></strong> / <em><%#Container.EvalView( "ext:Visits" )%></em></td>
              <td class="lastpost-container">
                <div class="last-publish" style="display: none;"><span class="date"><%#Container.EvalView( "LastPostPublishDate", "{0:yyyy-MM-dd HH:mm}" )%></span> by <a class="member-link" href="MemberView.aspx?Username=<%#Container.EvalView("LastPublishPostAuthor") %>"><%#Container.EvalView( "LastPublishPostAuthor" )%></a></div>
                <div class="last-modify" style="display: none;"><span class="date"><%#Container.EvalView( "LastPostModifyDate", "{0:yyyy-MM-dd HH:mm}" )%></span> by <a class="member-link" href="MemberView.aspx?Username=<%#Container.EvalView("LastModifyPostAuthor") %>"><%#Container.EvalView( "LastModifyPostAuthor" )%></a></div>
              </td>
              <td><asp:HyperLink runat="server" ID="DeleteTopicLink" Text="删" /> <asp:HyperLink runat="server" ID="TopTopicLink" Text="顶" /></td>
            </tr>
          </xc:Presenter>
        </ItemTemplate>
      </asp:Repeater>
    </table>

    <script language="javascript" type="text/javascript">
      function showLastPublish() {

        var topicList = document.getElementById('topicList');


        var infos = topicList.getElementsByTagName("div");

        for (var i = 0; i < infos.length; i++) {
          if (infos[i].className == "last-publish")
            infos[i].style.display = "block";

          if (infos[i].className == "last-modify")
            infos[i].style.display = "none";
        }

        document.getElementById("LastPublishButton").style.color = "#000000";
        document.getElementById("LastModifyButton").style.color = "#999999";
      }

      function showLastModify() {
        var topicList = document.getElementById('topicList');


        var infos = topicList.getElementsByTagName("div");

        for (var i = 0; i < infos.length; i++) {
          if (infos[i].className == "last-publish")
            infos[i].style.display = "none";

          if (infos[i].className == "last-modify")
            infos[i].style.display = "block";
        }

        document.getElementById("LastModifyButton").style.color = "#000000";
        document.getElementById("LastPublishButton").style.color = "#999999";
      }

      showLastPublish();
    </script>

  </asp:PlaceHolder>
  <div style="padding: 20px 20px;">
    <asp:Repeater ID="ChildPanels" runat="server" DataSource='<%#Container.EvalView( "ChildPanels" ) %>'>
      <ItemTemplate>
        <uc:PanelPresenter ID="PanelFramePresenter" runat="server" />
      </ItemTemplate>
    </asp:Repeater>
  </div>
</div>
